<!DOCTYPE html>












  


<html class="theme-next mist use-motion" lang="zh-CN">
<head><meta name="generator" content="Hexo 3.8.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">


























<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2">

<link rel="stylesheet" href="/css/main.css?v=6.7.0">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=6.7.0">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=6.7.0">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=6.7.0">


  <link rel="mask-icon" href="/images/logo.svg?v=6.7.0" color="#222">







<script id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Mist',
    version: '6.7.0',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: false,
    fastclick: false,
    lazyload: false,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>


  




  <meta name="description" content="neditor是从ueditor改写过来了，做了不少优化，我最喜欢的就是去掉了服务端附件配置请求。还有一个有点就是，可以很方便的对接七牛cdn或oss。如果是简单的使用可以用vue-neditor-wrap,复杂场景下会有bug，所以自己写了个组件，将必要的js引入放到了index.html中。下面是使用注意事项，追后有本示例的源码。">
<meta name="keywords" content="vue,ueditor,neditor">
<meta property="og:type" content="article">
<meta property="og:title" content="vue中使用neditor">
<meta property="og:url" content="https://www.xingjiehu.com/2019/09/03/cktnq12o5004rx0trdu7xsccj/index.html">
<meta property="og:site_name" content="shooke&#39;s blog">
<meta property="og:description" content="neditor是从ueditor改写过来了，做了不少优化，我最喜欢的就是去掉了服务端附件配置请求。还有一个有点就是，可以很方便的对接七牛cdn或oss。如果是简单的使用可以用vue-neditor-wrap,复杂场景下会有bug，所以自己写了个组件，将必要的js引入放到了index.html中。下面是使用注意事项，追后有本示例的源码。">
<meta property="og:locale" content="zh-CN">
<meta property="og:updated_time" content="2021-09-15T08:59:28.706Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="vue中使用neditor">
<meta name="twitter:description" content="neditor是从ueditor改写过来了，做了不少优化，我最喜欢的就是去掉了服务端附件配置请求。还有一个有点就是，可以很方便的对接七牛cdn或oss。如果是简单的使用可以用vue-neditor-wrap,复杂场景下会有bug，所以自己写了个组件，将必要的js引入放到了index.html中。下面是使用注意事项，追后有本示例的源码。">



  <link rel="alternate" href="/atom.xml" title="shooke's blog" type="application/atom+xml">




  <link rel="canonical" href="https://www.xingjiehu.com/2019/09/03/cktnq12o5004rx0trdu7xsccj/">



<script id="page.configurations">
  CONFIG.page = {
    sidebar: "",
  };
</script>

  <title>vue中使用neditor - shooke's blog</title>
  












  <noscript>
  <style>
  .use-motion .motion-element,
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-title { opacity: initial; }

  .use-motion .logo,
  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

  <!-- google 验证 -->
  <meta name="google-site-verification" content="9Y6X9yptaHlOdppRk7mld_uHsSibf3lPB8c_60zPyF0">
  <!-- baidu 验证和收录推送 -->
  <meta name="baidu-site-verification" content="lCJxAeYryx">
</head>

<body itemscope="" itemtype="http://schema.org/WebPage" lang="zh-CN">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope="" itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">shooke's blog</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
    
    
  </div>

  <div class="site-nav-toggle">
    <button aria-label="切换导航栏">
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>



<nav class="site-nav">
  
    <ul id="menu" class="menu">
      
        
        
        
          
          <li class="menu-item menu-item-home">

    
    
    
      
    

    

    <a href="/" rel="section"><i class="menu-item-icon fa fa-fw fa-home"></i> <br>首页</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-tags">

    
    
    
      
    

    

    <a href="/tags/" rel="section"><i class="menu-item-icon fa fa-fw fa-tags"></i> <br>标签</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-categories">

    
    
    
      
    

    

    <a href="/categories/" rel="section"><i class="menu-item-icon fa fa-fw fa-th"></i> <br>分类</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-archives">

    
    
    
      
    

    

    <a href="/archives/" rel="section"><i class="menu-item-icon fa fa-fw fa-archive"></i> <br>归档</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-about">

    
    
    
      
    

    

    <a href="/about/" rel="section"><i class="menu-item-icon fa fa-fw fa-user"></i> <br>关于</a>

  </li>

      
      
    </ul>
  

  
    

  

  
</nav>



  



</div>
    </header>

    


    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  

  <article class="post post-type-normal" itemscope="" itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://www.xingjiehu.com/2019/09/03/cktnq12o5004rx0trdu7xsccj/">

    <span hidden itemprop="author" itemscope="" itemtype="http://schema.org/Person">
      <meta itemprop="name" content="shooke">
      <meta itemprop="description" content="平时写点技术文章，分享一些经验，予人玫瑰手有余香">
      <meta itemprop="image" content="/images/avatar.gif">
    </span>

    <span hidden itemprop="publisher" itemscope="" itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="shooke's blog">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">vue中使用neditor

              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">

            
            
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              

              
                
              

              <time title="创建时间：2019-09-03 16:48:11" itemprop="dateCreated datePublished" datetime="2019-09-03T16:48:11+08:00">2019-09-03</time>
            

            
              

              
                
                <span class="post-meta-divider">|</span>
                

                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                
                  <span class="post-meta-item-text">更新于</span>
                
                <time title="修改时间：2021-09-15 16:59:28" itemprop="dateModified" datetime="2021-09-15T16:59:28+08:00">2021-09-15</time>
              
            
          </span>

          
            <span class="post-category">
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope="" itemtype="http://schema.org/Thing"><a href="/categories/笔记/" itemprop="url" rel="index"><span itemprop="name">笔记</span></a></span>

                
                
              
            </span>
          

          
            
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <p>neditor是从ueditor改写过来了，做了不少优化，我最喜欢的就是去掉了服务端附件配置请求。还有一个有点就是，可以很方便的对接七牛cdn或oss。<br>如果是简单的使用可以用<code>vue-neditor-wrap</code>,复杂场景下会有bug，所以自己写了个组件，将必要的js引入放到了index.html中。下面是使用注意事项，追后有本示例的源码。</p>
<a id="more"></a>
<h2 id="将neditor放到项目中"><a href="#将neditor放到项目中" class="headerlink" title="将neditor放到项目中"></a>将neditor放到项目中</h2><p>这里将neditor放到/public下</p>
<h2 id="配合public-index-html添加neditor引用"><a href="#配合public-index-html添加neditor引用" class="headerlink" title="配合public/index.html添加neditor引用"></a>配合public/index.html添加neditor引用</h2><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">&lt;script type=&quot;text/javascript&quot; charset=&quot;utf-8&quot; src=&quot;&lt;%= BASE_URL %&gt;lib/neditor/neditor.config.js&quot;&gt;&lt;/script&gt;</span><br><span class="line">&lt;script type=&quot;text/javascript&quot; charset=&quot;utf-8&quot; src=&quot;&lt;%= BASE_URL %&gt;lib/neditor/neditor.all.min.js&quot;&gt; &lt;/script&gt;</span><br></pre></td></tr></table></figure>
<h2 id="创建一个模块初始化neditor"><a href="#创建一个模块初始化neditor" class="headerlink" title="创建一个模块初始化neditor"></a>创建一个模块初始化neditor</h2><p>components/neditor/index.vue<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br><span class="line">197</span><br><span class="line">198</span><br><span class="line">199</span><br><span class="line">200</span><br><span class="line">201</span><br><span class="line">202</span><br><span class="line">203</span><br><span class="line">204</span><br><span class="line">205</span><br><span class="line">206</span><br><span class="line">207</span><br><span class="line">208</span><br><span class="line">209</span><br><span class="line">210</span><br><span class="line">211</span><br><span class="line">212</span><br><span class="line">213</span><br><span class="line">214</span><br><span class="line">215</span><br><span class="line">216</span><br><span class="line">217</span><br><span class="line">218</span><br><span class="line">219</span><br></pre></td><td class="code"><pre><span class="line">&lt;template&gt;</span><br><span class="line">&lt;div&gt;</span><br><span class="line">  &lt;script :id=&quot;id&quot; :name=&quot;name&quot; type=&quot;text/plain&quot;&gt;&lt;/script&gt;</span><br><span class="line">  &lt;/div&gt;</span><br><span class="line">&lt;/template&gt;</span><br><span class="line"></span><br><span class="line">&lt;script&gt;</span><br><span class="line">import config from &apos;./ueditor.config&apos;</span><br><span class="line">// 一个简单的事件订阅发布的实现,取代原始Event对象,提升IE下的兼容性</span><br><span class="line">class LoadEvent &#123;</span><br><span class="line">  constructor () &#123;</span><br><span class="line">    this.listeners = &#123;&#125;</span><br><span class="line">  &#125;</span><br><span class="line">  on (eventName, callback) &#123;</span><br><span class="line">    this.listeners[eventName] === undefined</span><br><span class="line">      ? (this.listeners[eventName] = [])</span><br><span class="line">      : &apos;&apos;</span><br><span class="line">    this.listeners[eventName].push(callback)</span><br><span class="line">  &#125;</span><br><span class="line">  emit (eventName) &#123;</span><br><span class="line">    this.listeners[eventName] &amp;&amp;</span><br><span class="line">      this.listeners[eventName].forEach(callback =&gt; callback())</span><br><span class="line">  &#125;</span><br><span class="line">&#125;</span><br><span class="line">export default &#123;</span><br><span class="line">  name: &apos;VueNeditorWrap&apos;,</span><br><span class="line">  data () &#123;</span><br><span class="line">    return &#123;</span><br><span class="line">      id:</span><br><span class="line">        &apos;editor&apos; +</span><br><span class="line">        Math.random()</span><br><span class="line">          .toString()</span><br><span class="line">          .slice(-10),</span><br><span class="line">      editor: null,</span><br><span class="line">      isReady: false, // 实例是否已经ready</span><br><span class="line">      readyValue: &apos;&apos;, // ready之后给编辑器设置的值</span><br><span class="line">      defaultConfig: &#123;</span><br><span class="line">        UEDITOR_HOME_URL: &apos;./public/NEditor/&apos;,</span><br><span class="line">        enableAutoSave: false</span><br><span class="line">      &#125;</span><br><span class="line">    &#125;</span><br><span class="line">  &#125;,</span><br><span class="line">  props: &#123;</span><br><span class="line">    value: &#123;</span><br><span class="line">      type: String,</span><br><span class="line">      default: &apos;&apos;</span><br><span class="line">    &#125;,</span><br><span class="line">    config: &#123;</span><br><span class="line">      type: Object,</span><br><span class="line">      default: function () &#123;</span><br><span class="line">        return &#123;&#125;</span><br><span class="line">      &#125;</span><br><span class="line">    &#125;,</span><br><span class="line">    init: &#123;</span><br><span class="line">      type: Function,</span><br><span class="line">      default: function () &#123;</span><br><span class="line">        return () =&gt; &#123;&#125;</span><br><span class="line">      &#125;</span><br><span class="line">    &#125;,</span><br><span class="line">    destroy: Boolean,</span><br><span class="line">    name: String</span><br><span class="line">  &#125;,</span><br><span class="line">  computed: &#123;</span><br><span class="line">    mixedConfig () &#123;</span><br><span class="line">      return Object.assign(&#123;&#125;, this.defaultConfig, config)</span><br><span class="line">    &#125;</span><br><span class="line">  &#125;,</span><br><span class="line">  methods: &#123;</span><br><span class="line">    // 添加自定义按钮</span><br><span class="line">    registerButton: (&#123; name, icon, tip, handler, UE = window.UE &#125;) =&gt; &#123;</span><br><span class="line">      UE.registerUI(name, (editor, name) =&gt; &#123;</span><br><span class="line">        editor.registerCommand(name, &#123;</span><br><span class="line">          execCommand: () =&gt; &#123;</span><br><span class="line">            handler(editor, name)</span><br><span class="line">          &#125;</span><br><span class="line">        &#125;)</span><br><span class="line">        const btn = new UE.ui.Button(&#123;</span><br><span class="line">          name,</span><br><span class="line">          title: tip,</span><br><span class="line">          cssRules: `background-image: url($&#123;icon&#125;) !important;background-size: cover;`,</span><br><span class="line">          onclick () &#123;</span><br><span class="line">            editor.execCommand(name)</span><br><span class="line">          &#125;</span><br><span class="line">        &#125;)</span><br><span class="line">        editor.addListener(&apos;selectionchange&apos;, () =&gt; &#123;</span><br><span class="line">          const state = editor.queryCommandState(name)</span><br><span class="line">          if (state === -1) &#123;</span><br><span class="line">            btn.setDisabled(true)</span><br><span class="line">            btn.setChecked(false)</span><br><span class="line">          &#125; else &#123;</span><br><span class="line">            btn.setDisabled(false)</span><br><span class="line">            btn.setChecked(state)</span><br><span class="line">          &#125;</span><br><span class="line">        &#125;)</span><br><span class="line">        return btn</span><br><span class="line">      &#125;)</span><br><span class="line">    &#125;,</span><br><span class="line">    // 实例化编辑器之前-JS依赖检测</span><br><span class="line">    _beforeInitEditor (value) &#123;</span><br><span class="line">      // console.log(&apos;_beforeInitEditor&apos;, value + &apos;--&apos;)</span><br><span class="line">      // 准确判断ueditor.config.js和ueditor.all.js是否均已加载 仅加载完ueditor.config.js时UE对象和UEDITOR_CONFIG对象也存在,仅加载完ueditor.all.js时UEDITOR_CONFIG对象也存在,但为空对象</span><br><span class="line">      !!window.UE &amp;&amp;</span><br><span class="line">      !!window.UEDITOR_CONFIG &amp;&amp;</span><br><span class="line">      Object.keys(window.UEDITOR_CONFIG).length !== 0 &amp;&amp;</span><br><span class="line">      !!window.UE.getEditor</span><br><span class="line">        ? this._initEditor(value)</span><br><span class="line">        : this._loadScripts().then(() =&gt; this._initEditor(value))</span><br><span class="line">    &#125;,</span><br><span class="line">    // 实例化编辑器</span><br><span class="line">    _initEditor (value) &#123;</span><br><span class="line">      this.$nextTick(() =&gt; &#123;</span><br><span class="line">        this.init()</span><br><span class="line">        this.editor = window.UE.getEditor(this.id, this.mixedConfig)</span><br><span class="line">        this.readyValue = value</span><br><span class="line">        this.editor.addListener(&apos;ready&apos;, () =&gt; &#123;</span><br><span class="line">          this.isReady = true</span><br><span class="line">          this.$emit(&apos;ready&apos;, this.editor)</span><br><span class="line">          this.editor.setContent(this.readyValue)</span><br><span class="line">          this.editor.addListener(&apos;contentChange&apos;, () =&gt; &#123;</span><br><span class="line">            // console.log(&apos;input&apos;, this.editor.getContent())</span><br><span class="line">            this.$emit(&apos;input&apos;, this.editor.getContent())</span><br><span class="line">          &#125;)</span><br><span class="line">        &#125;)</span><br><span class="line">      &#125;)</span><br><span class="line">    &#125;,</span><br><span class="line">    // 动态添加JS依赖</span><br><span class="line">    _loadScripts () &#123;</span><br><span class="line">      // 确保多个实例同时渲染时不会重复创建SCRIPT标签</span><br><span class="line">      if (window.loadEnv) &#123;</span><br><span class="line">        return new Promise((resolve, reject) =&gt; &#123;</span><br><span class="line">          window.loadEnv.on(&apos;scriptsLoaded&apos;, function () &#123;</span><br><span class="line">            resolve()</span><br><span class="line">          &#125;)</span><br><span class="line">        &#125;)</span><br><span class="line">      &#125; else &#123;</span><br><span class="line">        window.loadEnv = new LoadEvent()</span><br><span class="line">        return new Promise((resolve, reject) =&gt; &#123;</span><br><span class="line">          // 如果在其他地方只引用ueditor.all.min.js，在加载ueditor.config.js之后仍需要重新加载ueditor.all.min.js，所以必须确保ueditor.config.js已加载</span><br><span class="line">          // this._loadService().then(() =&gt; this._loadConfig()).then(() =&gt; this._loadCore()).then(() =&gt; &#123;</span><br><span class="line">          //   window.loadEnv.emit(&quot;scriptsLoaded&quot;);</span><br><span class="line">          //   resolve();</span><br><span class="line">          // &#125;);</span><br><span class="line">          const that = this</span><br><span class="line">          that._loadParse().then(() =&gt; that._loadConfig()).then(() =&gt; that._loadCore()).then(() =&gt; that._loadService()).then(() =&gt; &#123;</span><br><span class="line">            window.loadEnv.emit(&apos;scriptsLoaded&apos;)</span><br><span class="line">            resolve()</span><br><span class="line">          &#125;).catch(err =&gt; &#123;</span><br><span class="line">            console.error(err)</span><br><span class="line">          &#125;)</span><br><span class="line">        &#125;)</span><br><span class="line">      &#125;</span><br><span class="line">    &#125;,</span><br><span class="line">    _loadConfig () &#123;</span><br><span class="line">      return new Promise((resolve, reject) =&gt; &#123;</span><br><span class="line">        if (</span><br><span class="line">          !!window.UE &amp;&amp;</span><br><span class="line">          !!window.UEDITOR_CONFIG &amp;&amp;</span><br><span class="line">          Object.keys(window.UEDITOR_CONFIG).length !== 0</span><br><span class="line">        ) &#123;</span><br><span class="line">          resolve()</span><br><span class="line">        &#125;</span><br><span class="line">      &#125;)</span><br><span class="line">    &#125;,</span><br><span class="line">    _loadService () &#123;</span><br><span class="line">      return new Promise((resolve, reject) =&gt; &#123;</span><br><span class="line">        let coreScript = document.createElement(&apos;script&apos;)</span><br><span class="line">        coreScript.type = &apos;text/javascript&apos;</span><br><span class="line">        coreScript.src = this.mixedConfig.UEDITOR_HOME_URL + &apos;neditor.service.js&apos;</span><br><span class="line">        document.getElementsByTagName(&apos;head&apos;)[0].appendChild(coreScript)</span><br><span class="line">        coreScript.onload = function () &#123;</span><br><span class="line">          resolve()</span><br><span class="line">        &#125;</span><br><span class="line">      &#125;)</span><br><span class="line">    &#125;,</span><br><span class="line">    _loadParse () &#123;</span><br><span class="line">      return new Promise((resolve, reject) =&gt; &#123;</span><br><span class="line">        let coreScript = document.createElement(&apos;script&apos;)</span><br><span class="line">        coreScript.type = &apos;text/javascript&apos;</span><br><span class="line">        coreScript.src =</span><br><span class="line">          this.mixedConfig.UEDITOR_HOME_URL + &apos;neditor.parse.min.js&apos;</span><br><span class="line">        document.getElementsByTagName(&apos;head&apos;)[0].appendChild(coreScript)</span><br><span class="line">        coreScript.onload = function () &#123;</span><br><span class="line">          resolve()</span><br><span class="line">        &#125;</span><br><span class="line">      &#125;)</span><br><span class="line">    &#125;,</span><br><span class="line">    _loadCore () &#123;</span><br><span class="line">      return new Promise((resolve, reject) =&gt; &#123;</span><br><span class="line">        resolve()</span><br><span class="line">      &#125;)</span><br><span class="line">    &#125;,</span><br><span class="line">    // 设置内容</span><br><span class="line">    _setContent (value) &#123;</span><br><span class="line">      if (this.isReady) &#123;</span><br><span class="line">        // console.log(&apos;setContentisReady&apos;, value)</span><br><span class="line">        value === this.editor.getContent() || this.editor.setContent(value)</span><br><span class="line">      &#125; else &#123;</span><br><span class="line">        // console.log(&apos;noisReady&apos;, value)</span><br><span class="line">        this.readyValue = value</span><br><span class="line">      &#125;</span><br><span class="line">    &#125;</span><br><span class="line">  &#125;,</span><br><span class="line">  beforeDestroy () &#123;</span><br><span class="line">    if (this.destroy &amp;&amp; this.editor &amp;&amp; this.editor.destroy) &#123;</span><br><span class="line">      this.editor.destroy()</span><br><span class="line">    &#125;</span><br><span class="line">  &#125;,</span><br><span class="line">  // v-model语法糖实现</span><br><span class="line">  watch: &#123;</span><br><span class="line">    value: &#123;</span><br><span class="line">      handler (value) &#123;</span><br><span class="line">        // console.log(&apos;vvv===&apos;, value)</span><br><span class="line">        this.editor ? this._setContent(value) : this._beforeInitEditor(value)</span><br><span class="line">      &#125;,</span><br><span class="line">      immediate: true</span><br><span class="line">    &#125;</span><br><span class="line">  &#125;</span><br><span class="line">&#125;</span><br><span class="line">&lt;/script&gt;</span><br></pre></td></tr></table></figure></p>
<p>components/neditor/neditor.config.js<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br></pre></td><td class="code"><pre><span class="line">export default &#123;</span><br><span class="line">  UEDITOR_HOME_URL: process.env.BASE_URL + &apos;neditor/&apos;,</span><br><span class="line">  // 编辑器不自动被内容撑高</span><br><span class="line">  autoHeightEnabled: false,</span><br><span class="line">  // 初始容器高度</span><br><span class="line">  initialFrameHeight: 350,</span><br><span class="line">  // 初始容器宽度</span><br><span class="line">  initialFrameWidth: &apos;100%&apos;,</span><br><span class="line">  catchRemoteImageEnable: false,</span><br><span class="line">  imageMaxSize: 10248000, // 上传大小限制，单位B</span><br><span class="line">  zIndex: 9999,</span><br><span class="line">  // 关闭自动保存</span><br><span class="line">  enableAutoSave: false,</span><br><span class="line">  // serverUrl: &apos;http://localhost/php/controller.php&apos;</span><br><span class="line">  serverUrl: &apos;&apos;,</span><br><span class="line"></span><br><span class="line">  imageUploadService: function (context, editor) &#123;</span><br><span class="line">    return &#123;</span><br><span class="line">      /** </span><br><span class="line">       * 触发fileQueued事件时执行</span><br><span class="line">       * 当文件被加入队列以后触发，用来设置上传相关的数据 (比如: url和自定义参数)</span><br><span class="line">       * @param &#123;Object&#125; file 当前选择的文件对象</span><br><span class="line">       */</span><br><span class="line">      setUploadData: function (file) &#123;</span><br><span class="line">        return file;</span><br><span class="line">      &#125;,</span><br><span class="line">      /**</span><br><span class="line">       * 触发uploadBeforeSend事件时执行</span><br><span class="line">       * 在文件上传之前触发，用来添加附带参数</span><br><span class="line">       * @param &#123;Object&#125; object 当前上传对象</span><br><span class="line">       * @param &#123;Object&#125; data 默认的上传参数，可以扩展此对象来控制上传参数</span><br><span class="line">       * @param &#123;Object&#125; headers 可以扩展此对象来控制上传头部</span><br><span class="line">       * @returns 上传参数对象</span><br><span class="line">       */</span><br><span class="line">      setFormData: function (object, data, headers) &#123;</span><br><span class="line">        return data;</span><br><span class="line">      &#125;,</span><br><span class="line">      /**</span><br><span class="line">       * 触发startUpload事件时执行</span><br><span class="line">       * 当开始上传流程时触发，用来设置Uploader配置项</span><br><span class="line">       * @param &#123;Object&#125; uploader</span><br><span class="line">       * @returns uploader</span><br><span class="line">       */</span><br><span class="line">      setUploaderOptions: function (uploader) &#123;</span><br><span class="line">        return uploader;</span><br><span class="line">      &#125;,</span><br><span class="line">      /**</span><br><span class="line">       * 触发uploadSuccess事件时执行</span><br><span class="line">       * 当文件上传成功时触发，可以在这里修改上传接口返回的response对象</span><br><span class="line">       * @param &#123;Object&#125; res 上传接口返回的response</span><br><span class="line">       * @returns &#123;Boolean&#125; 上传接口返回的response成功状态条件 (比如: res.code == 200)</span><br><span class="line">       */</span><br><span class="line">      getResponseSuccess: function (res) &#123;</span><br><span class="line">        return res.code == 200;</span><br><span class="line">      &#125;,</span><br><span class="line">      /* 指定上传接口返回的response中图片路径的字段，默认为 url</span><br><span class="line">       * 如果图片路径字段不是res的属性，可以写成 对象.属性 的方式，例如：data.url </span><br><span class="line">       * */</span><br><span class="line">      imageSrcField: &apos;url&apos;</span><br><span class="line">    &#125;</span><br><span class="line">  &#125;,</span><br><span class="line"></span><br><span class="line">  /**</span><br><span class="line">   * 视频上传service</span><br><span class="line">   * @param &#123;Object&#125; context UploadVideo对象 视频上传上下文</span><br><span class="line">   * @param &#123;Object&#125; editor  编辑器对象</span><br><span class="line">   * @returns videoUploadService 对象</span><br><span class="line">   */</span><br><span class="line">  videoUploadService: function (context, editor) &#123;</span><br><span class="line">    return &#123;</span><br><span class="line">      /** </span><br><span class="line">       * 触发fileQueued事件时执行</span><br><span class="line">       * 当文件被加入队列以后触发，用来设置上传相关的数据 (比如: url和自定义参数)</span><br><span class="line">       * @param &#123;Object&#125; file 当前选择的文件对象</span><br><span class="line">       */</span><br><span class="line">      setUploadData: function (file) &#123;</span><br><span class="line">        return file;</span><br><span class="line">      &#125;,</span><br><span class="line">      /**</span><br><span class="line">       * 触发uploadBeforeSend事件时执行</span><br><span class="line">       * 在文件上传之前触发，用来添加附带参数</span><br><span class="line">       * @param &#123;Object&#125; object 当前上传对象</span><br><span class="line">       * @param &#123;Object&#125; data 默认的上传参数，可以扩展此对象来控制上传参数</span><br><span class="line">       * @param &#123;Object&#125; headers 可以扩展此对象来控制上传头部</span><br><span class="line">       * @returns 上传参数对象</span><br><span class="line">       */</span><br><span class="line">      setFormData: function (object, data, headers) &#123;</span><br><span class="line">        return data;</span><br><span class="line">      &#125;,</span><br><span class="line">      /**</span><br><span class="line">       * 触发startUpload事件时执行</span><br><span class="line">       * 当开始上传流程时触发，用来设置Uploader配置项</span><br><span class="line">       * @param &#123;Object&#125; uploader</span><br><span class="line">       * @returns uploader</span><br><span class="line">       */</span><br><span class="line">      setUploaderOptions: function (uploader) &#123;</span><br><span class="line">        return uploader;</span><br><span class="line">      &#125;,</span><br><span class="line">      /**</span><br><span class="line">       * 触发uploadSuccess事件时执行</span><br><span class="line">       * 当文件上传成功时触发，可以在这里修改上传接口返回的response对象</span><br><span class="line">       * @param &#123;Object&#125; res 上传接口返回的response</span><br><span class="line">       * @returns &#123;Boolean&#125; 上传接口返回的response成功状态条件 (比如: res.code == 200)</span><br><span class="line">       */</span><br><span class="line">      getResponseSuccess: function (res) &#123;</span><br><span class="line">        return res.code == 200;</span><br><span class="line">      &#125;,</span><br><span class="line">      /* 指定上传接口返回的response中视频路径的字段，默认为 url</span><br><span class="line">       * 如果视频路径字段不是res的属性，可以写成 对象.属性 的方式，例如：data.url </span><br><span class="line">       * */</span><br><span class="line">      videoSrcField: &apos;url&apos;</span><br><span class="line">    &#125;</span><br><span class="line">  &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure></p>
<h2 id="在使用组件的地方调用即可"><a href="#在使用组件的地方调用即可" class="headerlink" title="在使用组件的地方调用即可"></a>在使用组件的地方调用即可</h2><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br></pre></td><td class="code"><pre><span class="line">&lt;template&gt;</span><br><span class="line">  &lt;div class=&quot;home&quot;&gt;</span><br><span class="line">    &lt;Neditor v-model=&quot;content&quot;/&gt;</span><br><span class="line">  &lt;/div&gt;</span><br><span class="line">&lt;/template&gt;</span><br><span class="line"></span><br><span class="line">&lt;script&gt;</span><br><span class="line">// @ is an alias to /src</span><br><span class="line">import Neditor from &apos;@/components/neditor/index.vue&apos;</span><br><span class="line"></span><br><span class="line">export default &#123;</span><br><span class="line">  name: &apos;home&apos;,</span><br><span class="line">  data()&#123;</span><br><span class="line">    return &#123;</span><br><span class="line">      content: &apos;hello&apos;</span><br><span class="line">    &#125;</span><br><span class="line">  &#125;,</span><br><span class="line">  components: &#123;</span><br><span class="line">    Neditor</span><br><span class="line">  &#125;</span><br><span class="line">&#125;</span><br><span class="line">&lt;/script&gt;</span><br></pre></td></tr></table></figure>
<h2 id="实例源码"><a href="#实例源码" class="headerlink" title="实例源码"></a>实例源码</h2><p><a href="https://gitee.com/shooke/vue-demo/tree/master/neditor" target="_blank" rel="noopener">https://gitee.com/shooke/vue-demo/tree/master/neditor</a></p>
<h2 id="参考资料"><a href="#参考资料" class="headerlink" title="参考资料"></a>参考资料</h2><p><a href="https://github.com/caiya/vue-neditor-wrap" target="_blank" rel="noopener">https://github.com/caiya/vue-neditor-wrap</a><br><a href="https://github.com/notadd/neditor" target="_blank" rel="noopener">https://github.com/notadd/neditor</a></p>

      
    </div>

    

    
    
    

    

    
      
    
    
      <div>
        <div style="padding: 10px 0; margin: 20px auto; width: 90%; text-align: center;">
  <div></div>
  <!--
  <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
    <span>领红包</span>
  </button>
  -->
  <div id="QR" style="display: block;">

    

    
      <div id="alipay" style="display: inline-block">
        <img id="alipay_qr" src="/assets/images/alipay_redpack.png" alt="shooke 支付宝">
        <p>支付宝</p>
      </div>
    

    

  </div>
</div>

      </div>
    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/vue/" rel="tag"># vue</a>
          
            <a href="/tags/ueditor/" rel="tag"># ueditor</a>
          
            <a href="/tags/neditor/" rel="tag"># neditor</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2019/08/22/cktnq12o9004zx0tr24nxdmrt/" rel="next" title="使用vue cli 3项目打包到指定目录">
                <i class="fa fa-chevron-left"></i> 使用vue cli 3项目打包到指定目录
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2019/09/25/cktnq12oq0063x0trqn6ytitx/" rel="prev" title="解决element ui el-select控件多选时option设置为disabled，但可以删除标签，造成无法恢复的bug">
                解决element ui el-select控件多选时option设置为disabled，但可以删除标签，造成无法恢复的bug <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>


  </div>


          </div>
          

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope="" itemtype="http://schema.org/Person">
            
              <p class="site-author-name" itemprop="name">shooke</p>
              <p class="site-description motion-element" itemprop="description">平时写点技术文章，分享一些经验，予人玫瑰手有余香</p>
          </div>

          
            <nav class="site-state motion-element">
              
                <div class="site-state-item site-state-posts">
                
                  <a href="/archives/">
                
                    <span class="site-state-item-count">89</span>
                    <span class="site-state-item-name">日志</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-categories">
                  <a href="/categories/index.html">
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">6</span>
                    <span class="site-state-item-name">分类</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-tags">
                  <a href="/tags/index.html">
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">111</span>
                    <span class="site-state-item-name">标签</span>
                  </a>
                </div>
              
            </nav>
          

          
            <div class="feed-link motion-element">
              <a href="/atom.xml" rel="alternate">
                <i class="fa fa-rss"></i>
                RSS
              </a>
            </div>
          

          
            <div class="links-of-author motion-element">
              
                <span class="links-of-author-item">
                  
                  
                    
                  
                  
                    
                  
                  <a href="https://github.com/shooke" title="GitHub &rarr; https://github.com/shooke" rel="noopener" target="_blank"><i class="fa fa-fw fa-github"></i>GitHub</a>
                </span>
              
                <span class="links-of-author-item">
                  
                  
                    
                  
                  
                    
                  
                  <a href="https://weibo.com/shooke" title="Weibo &rarr; https://weibo.com/shooke" rel="noopener" target="_blank"><i class="fa fa-fw fa-weibo"></i>Weibo</a>
                </span>
              
            </div>
          

          

          
          

          
            
          
          

        </div>
      </div>

      
      <!--noindex-->
        <div class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
            
            
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#将neditor放到项目中"><span class="nav-number">1.</span> <span class="nav-text">将neditor放到项目中</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#配合public-index-html添加neditor引用"><span class="nav-number">2.</span> <span class="nav-text">配合public/index.html添加neditor引用</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#创建一个模块初始化neditor"><span class="nav-number">3.</span> <span class="nav-text">创建一个模块初始化neditor</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#在使用组件的地方调用即可"><span class="nav-number">4.</span> <span class="nav-text">在使用组件的地方调用即可</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#实例源码"><span class="nav-number">5.</span> <span class="nav-text">实例源码</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#参考资料"><span class="nav-number">6.</span> <span class="nav-text">参考资料</span></a></li></ol></div>
            

          </div>
        </div>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2021</span>
  <span class="with-love" id="animate">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">shooke</span>

  

  
</div>


  <div class="powered-by">由 <a href="https://hexo.io" class="theme-link" rel="noopener" target="_blank">Hexo</a> 强力驱动 v3.8.0</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 – <a href="https://theme-next.org" class="theme-link" rel="noopener" target="_blank">NexT.Mist</a> v6.7.0</div>





    <script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?d6b6833304116ed43a46f8f77b49d030";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>


        








        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

    

    
  </div>

  

<script>
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>


























  
  <script src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>


  


  <script src="/js/src/utils.js?v=6.7.0"></script>

  <script src="/js/src/motion.js?v=6.7.0"></script>



  
  


  <script src="/js/src/schemes/muse.js?v=6.7.0"></script>




  
  <script src="/js/src/scrollspy.js?v=6.7.0"></script>
<script src="/js/src/post-details.js?v=6.7.0"></script>



  


  <script src="/js/src/bootstrap.js?v=6.7.0"></script>



  


  


  





  

  

  
  <script>
  (function(){
      var bp = document.createElement('script');
      var curProtocol = window.location.protocol.split(':')[0];
      if (curProtocol === 'https') {
          bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
      }
      else {
          bp.src = 'http://push.zhanzhang.baidu.com/push.js';
      }
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(bp, s);
  })();
  </script>


  

  

  

  

  

  

  

  

  

  

</body>
</html>
